package com.clkj.zhonghui.service.product;

import com.clkj.zhonghui.dao.product.*;
import com.clkj.zhonghui.pojo.common.DateFormatHelper;
import com.clkj.zhonghui.pojo.common.ExcelRead;
import com.clkj.zhonghui.pojo.common.OSSUtil;
import com.clkj.zhonghui.pojo.common.UploadFile;
import com.clkj.zhonghui.pojo.product.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartRequest;
import tk.mybatis.mapper.entity.Example;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.*;

/**
 * @Author：周佳润
 * @Date：2024/7/11 上午9:44
 */
@Service
public class ProductServiceImpl implements ProductService{

    @Autowired
    private ProductMapper productMapper;
    @Autowired
    private ProductBannerMapper productBannerMapper;
    @Autowired
    private ProductFormatMapper productFormatMapper;

    @Autowired
    private ProductSpecialsMapper productSpecialsMapper;

    @Autowired
    private ProductCommentMapper productCommentMapper;

    @Autowired
    private ProductAnswerMapper productAnswerMapper;

    @Autowired
    private CollectProductMapper collectProductMapper;

    @Autowired
    private RedisTemplate redisTemplate;


    @Override
    @Transactional(rollbackFor = {RuntimeException.class, Error.class})
    public void addProduct(Product product, HttpServletRequest request) {
        try {
            List<MultipartFile> formatPicList = ((MultipartRequest) request).getFiles("formatPic");
            List<MultipartFile> bannerPicList = ((MultipartRequest) request).getFiles("bannerPic");
            List<MultipartFile> detailPicList = ((MultipartRequest) request).getFiles("detailPic");
            MultipartFile file = ((MultipartRequest) request).getFile("file");
            if (file != null) {
                String productPic = OSSUtil.uploadingImg(file, "zhonghui/product");
                product.setProductPic(productPic);
            }
            productMapper.addProduct(product);
            Integer productId = product.getProductId();
            String bannerPic = null;
            //临时存储轮播图和详情图的集合
            List<ProductBanner> productBannerList = new ArrayList<>();
            if(bannerPicList.size()>0){
                for (MultipartFile multipartFile : bannerPicList) {
                    ProductBanner productBanner =new ProductBanner();
                    bannerPic = OSSUtil.uploadingImg(multipartFile,"zhonghui/bannerPic");
                    productBanner.setProductId(productId);//商品ID
                    productBanner.setPicName(bannerPic);//图片路径
                    productBanner.setPicStatus(1);//图片状态
                    String type = multipartFile.getContentType().split("/")[0];
                    if(type.equals("video")){
                        productBanner.setPicStyle(1);//图片或视频
                    }else {
                        productBanner.setPicStyle(0);
                    }
                    productBanner.setPicFlag(0);
                    productBannerList.add(productBanner);
                }
                productBannerMapper.insertList(productBannerList);
            }
            List<ProductBanner> productdetailList = new ArrayList<>();
            if(detailPicList.size()>0){
                for (MultipartFile multipartFile : detailPicList) {
                    ProductBanner productBanner =new ProductBanner();
                    bannerPic = OSSUtil.uploadingImg(multipartFile,"zhonghui/detailPic");
                    productBanner.setProductId(productId);//商品ID
                    productBanner.setPicName(bannerPic);//图片路径
                    productBanner.setPicStatus(1);//图片状态
                    productBanner.setPicFlag(1);
                    productBanner.setPicStyle(0);
                    productdetailList.add(productBanner);
                }
                productBannerMapper.insertList(productdetailList);
            }
            if(formatPicList.size()>0){
                for(int j = 0;j<product.getProductFormats().size();j++){
                    String detailPic = OSSUtil.uploadingImg(formatPicList.get(j),"zhenghui/format");
                    product.getProductFormats().get(j).setProductId(productId);
                    product.getProductFormats().get(j).setFormatImg(detailPic);
                    productFormatMapper.insertSelective(product.getProductFormats().get(j));
                }
            }
            //redisTemplate.opsForValue().decrement("notice_goods",1);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public PageInfo listProduct(Integer page, Integer size, Integer shopId, String productName, Integer productStatus) {
        PageHelper.startPage(page,size);
        Example example = new Example(Product.class);
        Example.Criteria criteria = example.createCriteria();
        if(shopId != null){
            criteria.andEqualTo("shopId", shopId);
        }
        if(productName!= null){
            criteria.andLike("productName", "%" + productName + "%");
        }
        if(productStatus!= -1 ){
            criteria.andEqualTo("productStatus", productStatus);
        }
        example.orderBy("productId").desc();
        return new PageInfo(productMapper.selectByExample(example));
    }

    @Override
    public void addOrEditFormat(ProductFormat productFormat,String flag, HttpServletRequest request) {
        MultipartFile file = ((MultipartRequest) request).getFile("formatPic");
        if (file != null) {
            String productPic  = OSSUtil.uploadingImg(file,"zhenghui/format");
            productFormat.setFormatImg(productPic);
        }
        if("add".equals(flag)){
            productFormatMapper.insertSelective(productFormat);

        }else{
            productFormatMapper.updateByPrimaryKeySelective(productFormat);
        }
    }

    @Override
    @Transactional(rollbackFor = {RuntimeException.class, Error.class})
    public void addBanner(Integer productId,HttpServletRequest request) {
        try {
            List<MultipartFile> bannerPicList = ((MultipartRequest) request).getFiles("bannerPic");
            List<ProductBanner> productBannerList = new ArrayList<>();
            String bannerPic = null;
            int i = 0;
            if(bannerPicList.size()>0){
                for (MultipartFile multipartFile : bannerPicList) {
                    ProductBanner productBanner =new ProductBanner();
                    bannerPic = OSSUtil.uploadingImg(multipartFile,"zhonghui/bannerPic");
                    productBanner.setProductId(productId);//商品ID
                    productBanner.setPicName(bannerPic);//图片路径
                    productBanner.setPicStatus(1);//图片状态
                    String type = multipartFile.getContentType().split("/")[0];
                    if(type.equals("video")){
                        productBanner.setPicStyle(1);//图片或视频
                    }else {
                        productBanner.setPicStyle(0);
                    }
                    productBanner.setPicFlag(0);
                    productBannerList.add(productBanner);
                }
            }
            productBannerMapper.insertList(productBannerList);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void delOrUpdate(String ids, Integer picFlag, Integer picStatus) {
        List<Integer> idList = new ArrayList<>();
        String [] id = ids.split(",");
        for (String s : id) {
            idList.add(Integer.parseInt(s));
        }
        Example example ;
        Example.Criteria criteria ;
        if(picFlag==0){
            example = new Example(ProductBanner.class);
            criteria = example.createCriteria();
            criteria.andIn("picId",idList);
            if(picStatus==0){
                productBannerMapper.deleteByExample(example);
            }else{
                ProductBanner productBanner = new ProductBanner();
                productBanner.setPicStatus(picStatus);
                productBannerMapper.updateByExampleSelective(productBanner,example);
            }
        }else{
            example = new Example(ProductBanner.class);
            criteria = example.createCriteria();
            criteria.andIn("picId",idList);
            if(picStatus==0){
                productBannerMapper.deleteByExample(example);
            }else{
                ProductBanner productBanner = new ProductBanner();
                productBanner.setPicStatus(picStatus);
                productBannerMapper.updateByExampleSelective(productBanner,example);
            }
        }
    }

    @Override
    @Transactional(rollbackFor = {RuntimeException.class, Error.class})
    public void addDeailPic(Integer productId,HttpServletRequest request) {
        try {
            List<MultipartFile> detailPicList = ((MultipartRequest) request).getFiles("detailPic");
            List<ProductBanner> productBannerList = new ArrayList<>();
            String bannerPic = null;
            if(detailPicList.size()>0){
                for (MultipartFile multipartFile : detailPicList) {
                    ProductBanner productBanner =new ProductBanner();
                    bannerPic = OSSUtil.uploadingImg(multipartFile,"zhonghui/detailPic");
                    productBanner.setProductId(productId);//商品ID
                    productBanner.setPicName(bannerPic);//图片路径
                    productBanner.setPicStatus(1);//图片状态
                    productBanner.setPicFlag(1);
                    productBanner.setPicStyle(0);
                    productBannerList.add(productBanner);
                }
            }
            productBannerMapper.insertList(productBannerList);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void updateProStatus(String ids, Integer productStatus) {
        List<Integer> idList = new ArrayList<>();
        String [] id = ids.split(",");
        for (String s : id) {
            idList.add(Integer.parseInt(s));
        }
        Example example = new Example(Product.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("productId",idList);
        Product pro = new Product();
        pro.setProductStatus(productStatus);
        productMapper.updateByExampleSelective(pro,example);
    }
    @Override
    public Map listProductDetail(Integer productId) {
        Map map = new HashMap();
        Example example = new Example(ProductBanner.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("productId",productId);
        map.put("banner",productBannerMapper.selectByExample(example));

        example =new Example(ProductFormat.class);
        criteria = example.createCriteria();
        criteria.andEqualTo("productId",productId);
        map.put("formats",productFormatMapper.selectByExample(example));

        example =new Example(Product.class);
        criteria = example.createCriteria();
        criteria.andEqualTo("productId",productId);
        map.put("product",productFormatMapper.selectByExample(example));
        return map;
    }

    @Override
    public void updatepro(Product product,HttpServletRequest request) {
        MultipartFile file = ((MultipartRequest) request).getFile("file");
        if (file != null) {
            String productPic  = OSSUtil.uploadingImg(file,"zhonghui/product");
            product.setProductPic(productPic);
        }
        productMapper.updateByPrimaryKeySelective(product);
        //redisTemplate.opsForValue().decrement("notice_goods",1);
    }

    @Override
    public void addSpecials(ProductSpecials productSpecials, String flag, HttpServletRequest request) {
        MultipartFile file = ((MultipartRequest) request).getFile("file");
        String fileName = "";
        if (file != null) {
            fileName  = OSSUtil.uploadingImg(file,"zhonghui/special");
            productSpecials.setSpecialImg(fileName);
        }
        if("add".equals(flag)){
            productSpecialsMapper.insertSelective(productSpecials);
        }else{
            productSpecialsMapper.updateByPrimaryKeySelective(productSpecials);
        }
    }

    @Override
    public List<ProductSpecials> getSpecials(Integer flag) {
        Example example = new Example(ProductSpecials.class);
        Example.Criteria criteria = example.createCriteria();
        if(flag!=0){
            criteria.andEqualTo("specialStatus",flag);
        }
        example.orderBy("specialId").desc();
        return productSpecialsMapper.selectByExample(example);
    }

    @Override
    public void updateSpecial(String ids, String status) {
        productSpecialsMapper.updateSpecialStatus(ids,status);
    }

    @Override
    public void deleteSpecial(String ids) {
        productSpecialsMapper.deleteSpecial(ids);
    }

    @Override
    public PageInfo getProductCommentList(Integer page, Integer size, Integer productId) {
        Example example = new Example(ProductComment.class);
        Example.Criteria criteria = example.createCriteria();
        if(productId!=null ){
            criteria.andEqualTo("productId",productId);
        }
        example.orderBy("topping").desc();
        example.orderBy("commentId").desc();
        return new PageInfo(productCommentMapper.selectByExample(example));
        /*PageHelper.startPage(page,size);
        return new PageInfo(productCommentMapper.getProductCommentList(productId));*/
    }

    @Override
    public void updateComment(String ids) {
        List<Integer> idList = new ArrayList<>();
        String [] id = ids.split(",");
        for (String s : id) {
            idList.add(Integer.parseInt(s));
        }
        Example example = new Example(ProductComment.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("commentId",idList);
        ProductComment productComment =new ProductComment();
        productComment.setCommentStatus(1);
        productCommentMapper.updateByExampleSelective(productComment,example);
    }

    @Override
    public void importComment(HttpServletRequest request) {
        try {
            Map map= null;
            MultipartFile file = ((MultipartRequest) request).getFile("file");
            File excelFile = UploadFile.multipartFileToFile(file);
            List<Map<String, Object>> result = ExcelRead.ReadExcelByRC(excelFile, file.getContentType(), 2, -1, false);
            map = new HashMap();
            int num = 0;
            ProductComment comment = null;
            List<ProductComment> commentList = new ArrayList<>();
            int batchSize = 100; // 每批次插入的数据量
            int batchCount = (result.size() + batchSize - 1) / batchSize; // 计算需要插入的批次数
            // 遍历每个批次
            for (int batchIndex = 0; batchIndex < batchCount; batchIndex++) {
                // 计算当前批次的起和结束索引。
                int startIndex = batchIndex * batchSize;
                int endIndex = Math.min(startIndex + batchSize, result.size());
                for (int i = startIndex; i < endIndex; i++) {
                    if (result.get(i).get("1") == null || result.get(i).get("1").equals("null")) {
                        break;
                    }
                    num++;
                    comment = new ProductComment();
                    comment.setProductId(Integer.parseInt(result.get(i).get("1").toString()));
                    comment.setCommentContent(result.get(i).get("2").toString());
                    comment.setUserId(Integer.parseInt(result.get(i).get("3").toString()));
                    comment.setCommentStar(Integer.parseInt(result.get(i).get("4").toString()));
                    comment.setCommentDate(result.get(i).get("5").toString());
                    comment.setTopping(Integer.parseInt(result.get(i).get("6").toString()));
                    comment.setCommentStatus(Integer.parseInt(result.get(i).get("7").toString()));
                    commentList.add(comment);
                }
                // 批量插入数据
                if (!commentList.isEmpty()) {
                    productCommentMapper.insertList(commentList);
                    commentList.clear(); // 清空列表以便下一次插入
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void deleteProductComm(String ids) {
        String  id[] = ids.split(",");
        List<Integer> idList = new ArrayList<>();
        for (String s : id) {
            idList.add(Integer.parseInt(s));
        }
        Example example =new Example(ProductComment.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("commentId",idList);
        productCommentMapper.deleteByExample(example);
    }

    @Override
    public void zhidingComment(String ids, Integer topping) {
        List<Integer> idList = new ArrayList<>();
        String [] id = ids.split(",");
        for (String s : id) {
            idList.add(Integer.parseInt(s));
        }
        Example example = new Example(ProductComment.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("commentId",idList);
        ProductComment productComment = new ProductComment();
        productComment.setTopping(topping);
        productCommentMapper.updateByExampleSelective(productComment,example);
    }


    @Override
    public PageInfo getAnswer(Integer page, Integer size, Integer productId,Integer parentId) {
        Example example = new Example(ProductAnswer.class);
        Example.Criteria criteria = example.createCriteria();
        if(productId!=null ){
            criteria.andEqualTo("productId",productId);
        }
        //parentId=0时为问题，其余为回答的题目ID
        if (parentId.equals(0)){
            criteria.andEqualTo("parentId",0);
            example.orderBy("answerId").desc();
            return new PageInfo(productAnswerMapper.selectByExample(example));
        }else {
            return new PageInfo(productAnswerMapper.selectByAnswer(productId));
        }
    }

    @Override
    public void updateAnswer(String ids, Integer status) {
        String id [] = ids.split(",");
        List<Integer> idList = new ArrayList<>();
        for (String s : id) {
            idList.add(Integer.parseInt(s));
        }
        Example example = new Example(ProductAnswer.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("answerId",idList);
        ProductAnswer answer = new ProductAnswer();
        answer.setAnswerStatus(status);
        productAnswerMapper.updateByExampleSelective(answer,example);
    }

    @Override
    public void importAnswer(HttpServletRequest request) {
        {
            try {
                Map map= null;
                MultipartFile file = ((MultipartRequest) request).getFile("file");
                File excelFile = UploadFile.multipartFileToFile(file);
                List<Map<String, Object>> result = ExcelRead.ReadExcelByRC(excelFile, file.getContentType(), 2, -1, false);
                map = new HashMap();
                int num = 0;
                ProductAnswer answer = null;
                List<ProductAnswer> answerList = new ArrayList<>();
                for (int i = 0; i < result.size(); i++) {
                    if(result.get(i).get("1")==null||result.get(i).get("1").equals("null")){
                        break;
                    }
                    num++;
                    answer = new ProductAnswer();
                    answer.setUserId(Integer.parseInt(result.get(i).get("1").toString()));
                    answer.setProductId(Integer.parseInt(result.get(i).get("2").toString()));
                    answer.setParentId(Integer.parseInt(result.get(i).get("3").toString()));
                    answer.setAnswerContent((result.get(i).get("4").toString()));
                    answer.setAnswerDate((result.get(i).get("5").toString()));
                    answer.setAnswerNum(0);
                    answer.setAnswerStatus(1);
                    answerList.add(answer);

                }
                Example example = null;
                Example.Criteria criteria = null;
                if(answerList.size()>0){
                    productAnswerMapper.insertList(answerList);
                    for (ProductAnswer answer1 : answerList) {
                        if(answer1.getParentId()!=0){
                            example= new Example(ProductAnswer.class);
                            criteria= example.createCriteria();
                            criteria.andEqualTo("answerId",answer1.getParentId());
                            answer =productAnswerMapper.selectOneByExample(example);
                            answer.setAnswerNum(answer.getAnswerNum()+1);
                            productAnswerMapper.updateByExampleSelective(answer,example);
                        }
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    @Override
    public void deleteProductAnswer(String ids) {
        String  id[] = ids.split(",");
        List<Integer> idList = new ArrayList<>();
        for (String s : id) {
            idList.add(Integer.parseInt(s));
        }
        Example example =new Example(ProductAnswer.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("answerId",idList);
        productAnswerMapper.deleteByExample(example);
    }

    @Override
    public List<ProductSpecials> listSpecials() {
        Example example = new Example(ProductSpecials.class);
        Example.Criteria criteria =example.createCriteria();
        criteria.andEqualTo("specialFlag",0).andEqualTo("specialStatus",1);
        example.orderBy("specialPaixu").desc();
        List<ProductSpecials> specials = productSpecialsMapper.selectByExample(example);
        for (ProductSpecials special : specials) {
            String []ids = special.getProductIds().split(",");
            example = new Example(Product.class);
            criteria = example.createCriteria();
            criteria.andIn("productId",Arrays.asList(ids));
            special.setProductList(productMapper.selectByExample(example));
        }

        return specials;
    }

    @Override
    public Map listProDetail(Integer productId,Integer userId) {
        Example example = new Example(ProductBanner.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("productId",productId).andEqualTo("picStatus",1);
        List<ProductBanner> bannerList = productBannerMapper.selectByExample(example);

        example = new Example(ProductFormat.class);
        criteria = example.createCriteria();
        criteria.andEqualTo("productId",productId);
        List<ProductFormat> formatList = productFormatMapper.selectByExample(example);

        Product product = productMapper.selectByPrimaryKey(productId);

        example = new Example(CollectProduct.class);
        criteria = example.createCriteria();
        criteria.andEqualTo("productId",productId);
        criteria.andEqualTo("userId",userId);
        CollectProduct collectProduct = collectProductMapper.selectOneByExample(example);
        if(collectProduct != null){
            product.setCollectFlag(1);
        }else {
            product.setCollectFlag(0);
        }
        //评论、问答
        List<ProductComment> comments = productCommentMapper.listComment(productId,0);//flag==0，查询前两条，否则查询全部

        List<ProductAnswer> answerList = productAnswerMapper.listAnswer(productId,0);

        Map map = new HashMap();
        map.put("bannerList",bannerList);
        map.put("formatList",formatList);
        map.put("product",product);
        map.put("comments",comments);
        map.put("answerList",answerList);



        return map;
    }

    @Override
    public PageInfo getProducts(Integer page,Integer size,String productName) {
        PageHelper.startPage(page,size);
        Example example = new Example(Product.class);
        Example.Criteria criteria = example.createCriteria();

        if(productName!= null){
            criteria.andLike("productName", "%" + productName + "%");
        }

        if(productName!= null){
            criteria.andEqualTo("productStatus",1);
        }

        example.orderBy("productId").desc();
        return new PageInfo( productMapper.selectByExample(example));
    }

    @Override
    public void addAnswer(ProductAnswer productAnswer) {
        productAnswer.setAnswerDate(DateFormatHelper.currentTimes());
        productAnswerMapper.insertSelective(productAnswer);
    }

    @Override
    public List<ProductAnswer> getAnswers(Integer productId) {
        //查询商品问题
        List<ProductAnswer> productAnswerList = productAnswerMapper.selectProductAnswer(productId);
        List<ProductAnswer> answerList = new ArrayList<>();
        for (ProductAnswer productAnswer : productAnswerList) {
            int answerId = productAnswer.getAnswerId();
            productAnswer.getAnswerId();
            answerList = productAnswerMapper.selectAnswerList(answerId);
            productAnswer.setReplyCount(answerList.size());
            if (!answerList.isEmpty()) {
                productAnswer.setReplyList(Collections.singletonList(answerList.get(0)));
            } else {
                productAnswer.setReplyList(new ArrayList<>());
            }
        }
        return productAnswerList;
    }

    @Override
    public ProductAnswer getAnswerAndReply(Integer answerId) {
        ProductAnswer productAnswer = productAnswerMapper.selectByPrimaryKey(answerId);
        Example example = new Example(ProductAnswer.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("parentId", answerId);
        criteria.andEqualTo("answerStatus", 1);
        example.orderBy("answerDate").desc();
        productAnswer.setReplyList(productAnswerMapper.selectByExample(example));
        return productAnswer;
    }

    @Override
    public List<ProductComment> getAppComment( Integer productId) {
        return productCommentMapper.selectAppComment(productId);
    }

    @Override
    public void addCollectProduct(Integer userId, Integer productId,Integer flag) {
        if(flag ==0){
            Example example =new Example(CollectProduct.class);
            Example.Criteria criteria = example.createCriteria();
            criteria.andEqualTo("userId",userId);
            criteria.andEqualTo("productId",productId);
            collectProductMapper.deleteByExample(example);
        }else{
            CollectProduct collectProduct = new CollectProduct();
            collectProduct.setUserId(userId);
            collectProduct.setProductId(productId);
            collectProductMapper.insertSelective(collectProduct);
        }
    }

    @Override
    public List<CollectProduct> listCollectProduct(Integer userId) {
        Example example = new Example(CollectProduct.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId", userId);
        List<CollectProduct>collectProductList =collectProductMapper.selectByExample(example);
        for (CollectProduct collectProduct : collectProductList) {
            example = new Example(Product.class);
            criteria = example.createCriteria();
            criteria.andEqualTo("productId", collectProduct.getProductId());
            collectProduct.setProducts(productMapper.selectByExample(example));
        }
        return collectProductList;
    }

    @Override
    public void delCollectProduct(String ids) {
        String  id[] = ids.split(",");
        List<Integer> idList = new ArrayList<>();
        for (String s : id) {
            idList.add(Integer.parseInt(s));
        }
        Example example =new Example(CollectProduct.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andIn("collectId",idList);
        collectProductMapper.deleteByExample(example);
    }

    @Override
    public List<Product> getProductByCategory(Integer categoryId) {
        Example example = new Example(Product.class);
        Example.Criteria criteria = example.createCriteria();
        if(categoryId!=-1){
            criteria.andEqualTo("categoryId", categoryId);
        }
        return productMapper.selectByExample(example);
    }

}
